package thread07;

public class Ticket implements Runnable{

    //100张票
    private int ticket = 100;

    @Override
    public void run() {
        while (true) {
            if (ticket > 0) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }

                System.out.println(Thread.currentThread().getName() + "..." + ticket);//输出一个ticket(模拟卖出去一张票),剩余的是ticket--
                ticket = ticket - 1;
            }
        }
    }
}
